﻿using System;
namespace EmlViewer.Helpers
{
    public static class MiscHelpers
    {
        public static string QuantityInflection(int quantity, string word, bool blankIfZero = true)
        {
            string inflection = String.Empty;
            if (blankIfZero)
            {
                if (quantity == 0)
                {
                    return String.Empty;
                }
            }
            if (Math.Abs(quantity) > 0)
            {
                inflection = "s";
            }
            string result = String.Format("{0} {1}{2}", quantity.ToString("####,###,##0"), word, inflection);
            return result;
        }
        public static string WrapForHtml(string plainText)
        {
            string result = "<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'></head><body>" +
                    plainText.Replace(Environment.NewLine, "</br>") + 
                    "</body></html>";
            return result;
        }
    }
}
